<?php

class Blocks extends CActiveRecord {
	/**
	 * The followings are the available columns in table 'blocks':
	 * @var integer $blocks_id
	 * @var string $blocks_module
	 * @var string $blocks_name
	 * @var string $blocks_header
	 * @var string $blocks_footer
	 * @var string $blocks_file
	 * @var string $blocks_position
	 * @var string $blocks_description
	 * @var string $blocks_picture
	 * var integer $blocks_active
	 * @var string $blocks_created_at
	 * @var string $blocks_changed_at
	 */
	
	public static $POSITIONS = array ();
	
	public function init() {
		$this->_initPositions ();
	}
	
	protected static function _initPositions() {
		self::$POSITIONS = array ('top-left' => Yii::t ( 'crm', 'Oben-Links' ), 'top-middle' => Yii::t ( 'crm', 'Oben-Mitte' ), 'top-right' => Yii::t ( 'crm', 'Oben-Rechts' ), 'center-left' => Yii::t ( 'crm', 'Mitte-Links' ), 'center-middle' => Yii::t ( 'crm', 'Mitte-Mitte' ), 'center-right' => Yii::t ( 'crm', 'Mitte-Rechts' ), 'bottom-left' => Yii::t ( 'crm', 'Unten-Links' ), 'bottom-middle' => Yii::t ( 'crm', 'Unten-Mitte' ), 'bottom-right' => Yii::t ( 'crm', 'Unten-Rechts' ) );
	}
	
	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className = __CLASS__) {
		return parent::model ( $className );
	}
	
	/**
	 * @return string the associated database table name
	 */
	public function tableName() {
		return 'blocks';
	}
	
	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules() {
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array (
			array ('blocks_name, blocks_file, blocks_position, blocks_description, blocks_created_at, blocks_changed_at, blocks_module', 'required' ), 
			array ('blocks_name, blocks_picture, blocks_module', 'length', 'max' => 50 ), 
			array ('blocks_header, blocks_footer, blocks_file, blocks_description', 'length', 'max' => 255 ), 
			array ('blocks_position', 'length', 'max' => 25 ),
			array ('blocks_active', 'bool') );
	}
	
	/**
	 * @return array relational rules.
	 */
	public function relations() {
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array ();
	}
	
	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels() {
		return array ('blocks_id' => Yii::t ( 'crm', 'ID' ), 'blocks_name' => Yii::t ( 'crm', 'Name' ), 'blocks_header' => Yii::t ( 'crm', 'Kopfzeile' ), 'blocks_footer' => Yii::t ( 'crm', 'Fußzeile' ), 'blocks_file' => Yii::t ( 'crm', 'Dateipfad' ), 'blocks_position' => Yii::t ( 'crm', 'Position' ), 'blocks_description' => Yii::t ( 'crm', 'Beschreibung' ), 'blocks_picture' => Yii::t ( 'crm', 'Screenshot' ) );
	}
	public function behaviors() {
		return array ('CRMTimeStampableBehavior' => array ('class' => 'littlecrm.db.behavior.CRMTimeStampableBehavior' ) );
	}
}